package pkmn.move;

import pkmn.battle.BattlePokemon;
import pkmn.status.Status;
import pkmn.status.StatusEnum;
import pkmn.type.Poison;
import pkmn.type.Steel;
import pkmn.type.Type;
import pkmn.util.Util;

public class ApplyPoison extends IndirectAction{

    @Override
    public void execute(BattlePokemon battlePokemon) {
        for (Type type : battlePokemon.getPokemon().getTypes()){
            if (type.equals(new Poison()) || type.equals(new Steel())){
                Util.printAndWait("It doesn't affect " + battlePokemon);
                return;
            }
        }
        if (battlePokemon.getPokemon().getStatus().equals(StatusEnum.poison)){
            Util.printAndWait(battlePokemon + " is already poisoned!");
        }else if (battlePokemon.getPokemon().getStatus().equals(StatusEnum.none)){
            battlePokemon.getPokemon().setStatus(new Status(StatusEnum.poison, -1));
            Util.printAndWait(battlePokemon + " is poisoned!");
        }else
            Util.printAndWait("But, it failed!");
    }
}
